/* ===============================================
   Unity风格材质面板 - 紧凑布局（参数+贴图在同一行）
   =============================================== */

/* 参数行样式 - Unity风格 */
.param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    min-height: 26px;
}

.param-row > label {
    flex: 0 0 70px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    text-align: right;
    padding-right: 8px;
    font-weight: 500;
}

.param-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 颜色选择器 */
.param-row input[type="color"] {
    width: 40px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    background: transparent;
}

.param-hex-input {
    flex: 1;
    max-width: 80px;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
}

/* 滑块 */
.param-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.param-row input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.param-value {
    width: 50px;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    text-align: center;
}

/* 贴图按钮 - Unity风格的小方块（在参数同一行） */
.texture-btn {
    flex: 0 0 28px;
    height: 22px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.texture-btn.has-texture {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.6);
}

.texture-btn:hover {
    background: rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.8);
}

.texture-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
}

.texture-btn.has-texture .texture-icon {
    color: rgba(255, 255, 255, 0.95);
}

.texture-btn:hover .texture-icon {
    color: rgba(255, 255, 255, 1);
}

/* 清除贴图按钮 */
.texture-clear {
    flex: 0 0 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.texture-clear:hover {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* 强度输入框 */
.param-intensity {
    flex: 0 0 50px;
    height: 22px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    text-align: center;
}

.param-intensity:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(0, 0, 0, 0.4);
}

/* 独立贴图行（法线、AO等） */
.param-row-texture-only .param-controls {
    gap: 4px;
}

.param-row-texture-only .texture-btn {
    flex: 1;
    max-width: 200px;
    justify-content: flex-start;
    padding-left: 8px;
    gap: 6px;
}

/* ===============================================
   贴图选择器弹窗样式
   =============================================== */

/* 模态弹窗遮罩 */
.texture-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.texture-selector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

/* 弹窗内容 */
.texture-selector-content {
    position: relative;
    width: 800px;
    max-width: 90vw;
    max-height: 80vh;
    background: #2a2d3a;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 弹窗头部 */
.texture-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.texture-selector-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.texture-selector-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.texture-selector-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* 标签页 */
.texture-selector-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.texture-selector-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.texture-selector-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.texture-selector-tab.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    color: #667eea;
}

/* 标签页内容 */
.texture-selector-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.texture-selector-tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.texture-selector-tab-content.active {
    display: flex;
}

/* 贴图库搜索 */
.texture-library-search {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.texture-library-search input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.texture-library-search input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(255, 255, 255, 0.08);
}

/* 贴图库列表 */
.texture-library-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.texture-library-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.texture-library-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(102, 126, 234, 0.4);
}

.texture-library-preview {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.texture-library-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.texture-library-info {
    flex: 1;
    min-width: 0;
}

.texture-library-name {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 元数据网格布局 */
.texture-library-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    margin-bottom: 8px;
}

.texture-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.texture-meta-label {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.texture-meta-value {
    color: rgba(255, 255, 255, 0.8);
}

.texture-refs-count {
    color: rgba(102, 126, 234, 0.9);
    font-weight: 500;
}

/* 材质引用列表 */
.texture-library-materials {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.texture-materials-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.texture-materials-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.texture-material-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    font-size: 11px;
    color: rgba(102, 126, 234, 0.9);
    white-space: nowrap;
}

/* 贴图加载尺寸指示器 */
.texture-loading-size {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.6);
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
}

/* 旧样式保留（向后兼容） */
.texture-library-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.texture-library-refs {
    font-size: 11px;
    color: rgba(102, 126, 234, 0.8);
}

.texture-library-select-btn {
    padding: 8px 20px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 6px;
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.texture-library-select-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
}

/* 空状态和加载状态 */
.texture-loading,
.texture-empty,
.texture-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.texture-error {
    color: rgba(244, 67, 54, 0.8);
}

/* 上传区域 */
.texture-upload-area {
    flex: 1;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.texture-upload-dropzone {
    width: 100%;
    max-width: 500px;
    padding: 60px 40px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.texture-upload-dropzone:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.05);
}

.texture-upload-dropzone.dragover {
    border-color: rgba(102, 126, 234, 0.8);
    background: rgba(102, 126, 234, 0.1);
}

.texture-upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.texture-upload-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.texture-upload-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* 滚动条样式 */
.texture-library-list::-webkit-scrollbar {
    width: 8px;
}

.texture-library-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.texture-library-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.texture-library-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

